//点名
//测试链接 https://leetcode.cn/problems/que-shi-de-shu-zi-lcof/
public class TakeAttendance {
    public int takeAttendance(int[] records) {
        int left = 0, right = records.length-1;

        while(left < right){
            int mid = left + (right - left)/2;
            if(records[mid] > mid){
                right = mid;
            }else{
                left = mid+1;
            }
        }
        if(left == records[records.length-1]){
            return left+1;
        }
        return left;
    }
}
